<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2021.3.23
 * Time: 18:08
 */

class Solution
{
    public function twoSum($array,$target)
    {
        $arrayLength = count($array);

        if($arrayLength <=1) {
            return false;
        }

        for ($i=0;$i<$arrayLength;$i++) {
            for ($j=$i+1;$j<$arrayLength;$j++){
                $diffValue = $target-$array[$i];
                if($diffValue == $array[$j]) {
                    return [$i,$j];
                }
            }
        }
        return false;
    }
}
$array = [2,5,5,11];
$target = 10;
$new = new Solution();
$res = $new->twoSum($array,$target);
var_dump($res);